<template>
  <div id="app">
    <keep-alive>
      <router-view></router-view>
    </keep-alive>
  </div>
</template>

<script>
export default {
  name: 'app',
  created() {
    console.log(process.env.BASE_PHONE_URL)
  },
  beforeCreate() {
    let system = {
      win: false,
      mac: false,
      xll: false
    }
    // 检测平台
    let p = navigator.platform
    system.win = p.indexOf('Win') === 0
    system.mac = p.indexOf('Mac') === 0
    system.x11 = (p === 'X11') || (p.indexOf('Linux') === 0)
    // 跳转语句
    if (system.win || system.mac || system.xll) {
      // alert('PC访问')
    } else {
      // alert('非PC访问')
      if (confirm('想要访问手机版网站吗？')) {
        location.href = process.env.BASE_PHONE_URL
      }
    }
  }
}
</script>
